import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { AddListDTO, ContrastQuery, ContrastVO, DeptListTreeVO, InheritData } from "@/api/budget/contrastDept/types";

/**
 * 左侧部门对照树形列表
 */
export const getDeptListTree = (query: ContrastQuery): AxiosPromise<DeptListTreeVO[]> => {
  return request({
    url: "/budget/contrast/getDeptListTree",
    method: "post",
    data: query
  });
};

/**
 * 查询部门对照列表
 * @param query
 * @returns {*}
 */

export const listContrast = (query?: ContrastQuery): AxiosPromise<ContrastVO[]> => {
  return request({
    url: "/budget/contrast/list",
    method: "post",
    data: query
  });
};

/**
 * 新增部门对照
 * @param data
 */
export const addContrast = (data: AddListDTO) => {
  return request({
    url: "/budget/contrast/saveContrast",
    method: "post",
    data: data
  });
};

/**
 * 删除部门对照
 * @param ids
 */
export const delContrast = (ids: Array<string | number>) => {
  return request({
    url: "/budget/contrast/remove",
    method: "post",
    data: ids
  });
};

export const verify = (data: InheritData) => {
  return request({
    url: "/budget/contrast/verify",
    method: "post",
    data: data
  });
};

/**
 * 继承数据
 * @param data
 */
export const saveInheritData = (data: InheritData) => {
  return request({
    url: "/budget/contrast/inheritData",
    method: "post",
    data: data
  });

};
